
<script type="text/javascript"> 
$(document).ready(function(){
//    $("#exemplequery").hide();
    $("#exemplelink").click(function () {
        $("#exemplequery").slideToggle("slow");
    });
});
</script>
 
<!-- MENU : BEGINNING______________________________________________________________________ -->
<center> <b> Home </b> </center>
<a href="." class="path" title="Go to import collection page"> Upload Collection </a>
<a href="help" class="path" title="(?) Help contents"> Help Contents </a>
<a href="about" class="path" title="About PhyloExplorer project..."> About </a>
<br />
<center> <b>Current collection</b> </center>
<a href="statistics" blockui="wait" class="path"
title="Go back to statistics for this subset of trees"> Back to statistics </a>
<a href="/downloadCollection" class="path" title="Download the (full or filtered) collection">Download collection</a>
<br />
<!-- MENU : END -->
     </td>
             <td class="content">
<!-- CONTENU : BEGINNING____________________________________________________________________ -->
<!-- query panel -->
<div class="query">
<form action="check" class="nopadding">
<!--<a onclick="javascript:toggleExemple();" id="exemplelink"> View example </a>&nbsp;-->
<input size=60  type=text 
onfocus="if(this.value=='Your query...'){this.value='';}" 
onblur="if(this.value==''){this.value='Your query...';}"
<%
if _query_:
    #
%>
value="<%$ _query_ %>"
<%
else:
    #
%>
value="Your query..."
<%|%>
name="query" /> 
<input type="submit" value="Search" class="button" blockui="wait"><br />
<tt id="exemplequery"> e.g: <b> {murinae} > 2 and {carnivora}==1 and not ({primates} or {laurasiatheria} < 4) </b>
<br /> 
<i>You can download your result after your query</i></tt>
</form>
<%
if _query_:
    #
%>
    Results for --&nbsp;<%$ _query_ %>&nbsp;--&nbsp;|&nbsp;<a blockui="wait" href=check?clear_query=1>Back to full collection</a>
<%
else:
    _query_ = ""
#
%>
</div>

<%
if _msg_:
    #
%>
    <div  class="error"><%$ _msg_ %></div>
<%|%>

<!-- Select on tree names -->
<center>
<form name="treename" action="check">
    <b>Display tree </b>&nbsp;
    <select name="index" onchange="javascript:document.treename.submit();">
<%
index = 0
for tree in _collection_:
    index += 1
    #
%>
     <option blockui="wait" value="<%$ index %>"
<%
    if _index_ == index:
        #
%>
        selected
    <%|%>
    ><%$ tree["name"] %> </option>
<%|%>
    </select>
</form>
</center>


<%#
Navigation buttons beetween trees
#%>

<!-- tree browser -->
<form action="check" class="browser">

<%
if len(_collection_) > 1:
    if _index_ > 1:
        #
%>
        &nbsp;<a href='check?index=<%$ _index_-1 %>'>Previous</a>&nbsp;
    <%|%>

    <input type="text" size="5" value="<%$ _index_ %>" name="index" />
    /<%$ len(_collection_) %>

<%
    if _index_ < len(_collection_):
        #
%>
        &nbsp;<a href='check?index=<%$ _index_+1 %>'>Next</a>&nbsp;
<%|%>
</form>
<!-- tree or not -->

<%
htmltree = ""
if len( _collection_ ) == 0:
    #
%>
   <div class="error">Empty collection</div>
<%
else:
    tree = _collection_[_index_-1]
    if tree:
        try:
            from phylocore.phylogenetictree import PhylogeneticTree
            htmltree += "<div class='treeName'>Tree Name : "+str(tree["name"])
            if not _cache_.has_key( tree["name"] ):
                ptree = PhylogeneticTree( tree["tree"], _reference_ )
                _cache_["nbtaxa"] = ptree.nb_taxa
                _cache_[tree["name"]] = ptree.display()
            htmltree += "  ("+str(_cache_["nbtaxa"])+" taxa)</div><br />"
            htmltree += _cache_[tree["name"]]
        except:
            #
%>
            <!-- error in the tree -->
            <div id="error" class="error"> An error occured with this tree : <%$ tree["tree"] %> </div><br />
        <%|%>

<%
    if _nbbadtaxa_:
        #
%>
    <center>
    <font color="red"> <%$ _nbbadtaxa_ %> bad taxa in this collection </font><br /><br />
    </center>
    <%|%>
    <a target="_blank" style="color:green"
       href="http://www.phylowidget.org/full/index.html?tree='<%$ tree["tree"] %>'"
       title="Display the ncbi tree as graph"> Click to visualize this tree using PhyloWidget </a>
    <br />
<%|%>
    <br />
    <a href="#bottom" class="posPage">&nbsp;Go to bottom&nbsp;</a>
    &nbsp;
    &nbsp;
    &nbsp;
    <a id="iNode" onClick="javascript:setNode();" 
      title="Click to show/hide intern node">Show/Hide intern nodes</a>
    &nbsp;
    <a id="toggleallparents" class="posPage" onClick="javascript:toggleInternNode();" 
      title="Click to show/hide all parents">Show/Hide all parents</a>
    <!-- Tree visualization -->
    <div class="tree">
    <br />
    <tt>
    <%$ htmltree %>
    </tt>
    <br />
    </div>
    <a href="#top" class="posPage">&nbsp;Go to top&nbsp;</a>

    <!-- div preview -->
    <div id="preview"></div>
<%|%>
<!-- tree browser -->
<form action="check" class="browser">

<%
if len(_collection_) > 1:
    if _index_ > 1:
        #
%>
        &nbsp;<a href='check?index=<%$ _index_-1 %>'>Previous</a>&nbsp;
    <%|%>

    <input type="text" size="5" value="<%$ _index_ %>" name="index" />
    /<%$ len(_collection_) %>

<%
    if _index_ < len(_collection_):
        #
%>
        &nbsp;<a href='check?index=<%$ _index_+1 %>'>Next</a>&nbsp;
<%|%>
</form>
<!-- CONTENT : END -->

